﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace diploma.core.data.objects
{
    public class Theme : DataObject
    {
        private long id_parent = 0;
        public Theme(long _id, string _title, long _id_parent)
            : base(_id, _title)
        {
            id_parent = _id_parent;
        }

        public string Title
        {
            get
            {
                return textField;
            }
        }
        public void SetTitle(string _value, bool _innerDataSourceChanges)
        {
            SetTextField(_value, _innerDataSourceChanges);
        }

        public void SetTitle(string _value)
        {
            SetTextField(_value);
        }

        public void SetParentId(long _value, bool _innerDataSourceChanges)
        {
            id_parent = _value;
            if (!_innerDataSourceChanges)
            {
                DataRouter.Instance.Act(DataActions.update, this.Type, this);
            }
        }

        public void SetParentId(long _value)
        {
            SetParentId(_value, false);
        }

        public long ParentId
        {
            get
            {
                return id_parent;
            }
        }

        public override DataObjectTypes Type
        {
            get
            {
                return DataObjectTypes.Theme;
            }
        }

        #region ISerializable Members

        public override void FromStream(System.IO.Stream _stream)
        {
            base.FromStream(_stream);
            /*content = ByteSerialization.StringFromBytes(_stream);
            instructions = ByteSerialization.StringFromBytes(_stream);*/
        }

        public override void ToStream(System.IO.Stream _stream)
        {
            base.ToStream(_stream);
            /*ByteSerialization.StringToBytes(_stream, content);
            ByteSerialization.StringToBytes(_stream, instructions);*/
        }

        #endregion
    }
}
